package com.chhh.cranelease.controller;

import com.chhh.cranelease.entity.Staff;
import com.chhh.cranelease.model.ResponseCode;
import com.chhh.cranelease.service.StaffService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("staff/")
public class StaffController {
    @Autowired
    private StaffService service;
    @RequestMapping("selectAll")
    public ResponseCode selectName(){
        List<Staff> list=service.selectAll();
        ResponseCode responseData=new ResponseCode();
        responseData.setErrorCode(0);
        responseData.setStatus("查询成功！");
        responseData.setObjectList(list);
        return responseData;
    }
    @RequestMapping("updateStaff")
    public ResponseCode updateStaff(Staff staff){
        Integer count=service.updateStaff(staff);
        ResponseCode responseData=new ResponseCode();
        responseData.setErrorCode(0);
        responseData.setObject(staff);
        return responseData;
    }
    @RequestMapping("bringCarStaff")
    public ResponseCode bringCarStaff(Staff staff){
        Integer count=service.bringCarStaff(staff);
        ResponseCode responseData=new ResponseCode();
        responseData.setErrorCode(0);
        responseData.setObject(staff);
        return responseData;
    }
}
